// 全局配置跟路径
let baseURL='http://www.itcbc.com:8080';
axios.defaults.baseURL=baseURL;


axios.interceptors.response.use(config => {
  let url = config.url;
  if (url.includes('/my/')){
  config.heafers['Authorization']=localStorage.getItem('token');

  }
  return config;
},function(reeor){
  return Promise.reject(error);
})
axios.interceptors.response.use(
  function (response) {
    let { status, message } = response.data;
    if (status === 1) layer.msg(message);
    return response;
  },
  function (error) {
    let { status, message } = error.response.data;
    if (status === 1 && message === '身份认证失败！') {
      localStorage.removeItem('token');
      location.href = './login.html';
    }
    layer.msg(message)
    return Promise.reject(error);
  }
);